// pages/pintuanzhifu/pintuanzhifu.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    showPicker: false,
    show: false,
    selectedFormattedTime: '',
    radio:'0',
    selectedAddress: null,
  },
  onChange(event) {
    this.setData({
      radio: event.detail,
    });
  },

  onClick(event) {
    const { name } = event.currentTarget.dataset;
    this.setData({
      radio: name,
    });
  },
  showPopup() {
    this.setData({ show: true });
  },

  onClose() {
    this.setData({ show: false });
  },
  showDateTimePicker() {
    this.setData({
      showPicker: true
    });
  },
  onConfirm(e) {
    const timestamp = e.detail;
  const date = new Date(timestamp);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0');
  const day = String(date.getDate()).padStart(2, '0');
  const hour = String(date.getHours()).padStart(2, '0');
  const minute = String(date.getMinutes()).padStart(2, '0');
  const formattedTime = `${year}-${month}-${day} ${hour}:${minute}`;
  wx.showToast({
    title: `选择的时间是 ${formattedTime}`,
    icon: 'none'
  });
  this.setData({
    showPicker: false,
    selectedFormattedTime: formattedTime,
    show: false
  });
  },
  onCancel() {
    this.setData({
      showPicker: false
    });
  },
  onClickLeft(){
    wx.navigateBack();
},
toDingdan(){
wx.navigateTo({
  url: '/pages/dingdan/dingdan',
})
},
navToDizhi() {
    wx.navigateTo({
      url: '/pages/dizhi/dizhi',
      success: (res) => {
        res.eventChannel.on('acceptDataFromDizhi', (data) => {
          this.setData({
            selectedAddress: data.selectedAddress,
          });
        });
      },
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})